package com.eshop.product.mapper;

import com.eshop.product.model.ProductIntro;
import org.apache.ibatis.annotations.*;

/**
 * @ClassName CategoryMapper
 * @Description
 * @Author 47980
 * @Date 2020/5/17 16:08
 * @Version V_1.0
 **/
@Mapper
public interface ProductIntroMapper {

    @Insert("INSERT INTO product_intro(content,product_id) VALUES(#{content},#{productId})")
    public void add(ProductIntro productIntro);

    @Update("UPDATE product_intro SET content=#{content},product_id=#{productId} WHERE id=#{id}")
    public void update(ProductIntro productIntro);

    @Delete("DELETE FROM product_intro WHERE id=#{id}")
    public void delete(Long id);

    @Select("SELECT * FROM product_intro where id=#{id}")
    @Results({
        @Result(column = "product_id", property = "productId")
    })
    public ProductIntro findById(Long id);
}
